<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>sort排序</h2>
</body>
<script>
    const arr=[
        {id:1001,name:'ipad10',price:2000},
        {id:1002,name:'ipad11',price:2500},
        {id:1003,name:'ipad12',price:2120},
        {id:1004,name:'ipad14',price:1890},
    ]
    arr.sort(function(v1,v2) {
        console.log('v1:',v1)
        console.log('v2:',v2)
        return v2.price-v1.price;
    })
    console.log('排序后：',arr)
</script>
</html>